#include "CGrid.h"
#include <iostream>
#include <sstream>
using namespace std;

CGrid::CGrid(int size)
{
	this->size = size;
	VGrid.resize(size*size);
}



CGrid::~CGrid(void)
{
}

char CGrid::Get_state(int pos[2])
{
	return VGrid[pos[0]+pos[1]*size];
}

void CGrid::Flip_state(int pos[2])
{
	if (VGrid[pos[0]+pos[1]*size] == 0)
		VGrid[pos[0]+pos[1]*size]=1;
	else
		VGrid[pos[0]+pos[1]*size]=0;
}

int CGrid::CGridConsoleDraw()
{
	system("CLS");
	for (int y=0; y < size ; y++)
	{
		for (int x=0; x < size; x++)
			cout << VGrid[x+y*size];
		cout << endl;
	}
	return 0;
}